package bma.common.thrift;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TMessage;
import org.apache.thrift.protocol.TProtocol;

public class TModuleProtocol extends TProtocolWrap {

	protected String module;

	public TModuleProtocol(TProtocol protocol) {
		super(protocol);
	}

	public TModuleProtocol(TProtocol protocol, String module) {
		super(protocol);
		this.module = module;
	}

	public String getModule() {
		return module;
	}

	public void setModule(String module) {
		this.module = module;
	}

	@Override
	public void writeMessageBegin(TMessage message) throws TException {
		TMessage msg = new TMessage(module + "." + message.name, message.type,
				message.seqid);
		super.writeMessageBegin(msg);
	}

}
